package com.xxxx.server.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxxx.server.pojo.Admin;
import com.xxxx.server.pojo.Announcement;
import com.xxxx.server.service.IAnnouncementService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 公告表 前端控制器
 * </p>
 *
 * @author mi-nuo-ji
 * @since 2022-03-21
 */
@RestController
@RequestMapping("/announcement")
public class AnnouncementController {

    @Autowired
    private IAnnouncementService announcementService;


    @ApiOperation(value = "获取所有公告列表")
    @GetMapping("/list")
    public List<Announcement> getAllAnnouncements(){
        QueryWrapper<Announcement> announcementQueryWrapper = new QueryWrapper<>();
        announcementQueryWrapper.ne("release_status",-2);
        announcementQueryWrapper.orderByDesc("ctime");
        return announcementService.list(announcementQueryWrapper);
    }
}
